import type { MockMethod } from 'vite-plugin-mock'
import Mock from 'mockjs'
import { testMock } from './test'

const rules: MockMethod[] = [
  {
    url: '/patient/message/list',
    method: 'get',
    timeout: 1000,
    response: () => {
      const data = []
      for (let i = 0; i < 10; i++) {
        data.push(
          Mock.mock({
            id: '@natural(100, 999)',
            demoFlag: '@natural(0,1)',
            name: '@cname',
            contact: '@cname',
            contactNumber: '1@natural(30,99)-@natural(1000,9999)-@natural(1000,9999)',
          })
        )
      }
      return {
        code: 200,
        msg: '获取数据成功',
        data:{
          rows:data,
          total:data.length,
        }
      }
    }
  },
  ...testMock
]

export default rules
